package com.zjg.service;

import java.util.List;
import java.util.Map;

import com.zjg.bean.Blog;
import com.zjg.bean.User;
import com.zjg.dao.BlogDaoImp;
import com.zjg.dao.UserDaoImp;
import com.zjg.dao.iface.BlogDao;
import com.zjg.dao.iface.UserDao;
import com.zjg.service.iface.BlogService;

public class BlogServiceImp  implements BlogService{
	BlogDao bd=new BlogDaoImp();
	@Override
	public List<Blog> getAllBlog() {
		
		return bd.getAllBlog();
	}
	@Override
	public List<Map<String, Object>> getBlogTypeList() {
		
		return bd.getBlogTypeList();
	}
	@Override
	public Blog getBlogById(String article_id) {
		Blog blog=new Blog();
		blog=bd.getBlogById(article_id);
		UserDao ud=new UserDaoImp();
		User user=ud.getUserById(blog.getOrder_user_id());
		blog.setArticle_message(user);
		return blog;
	}
	@Override
	public boolean setArticle(Blog blog) {
		boolean flag=false;
		if(bd.setArticle(blog)==2) {
			flag=true;
		};
		return flag;
	}

}
